package com.learn.hibernatevalidator.chapter05.groupconversion;

import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * @author: liyf
 * @create: 2025-01-07 21:39
 **/
@Data
public class Driver {

    @Min(
            value = 18,
            message = "You have to be 18 to drive a car",
            groups = DriverChecks.class
    )
    public int age;
    @AssertTrue(
            message = "You first have to pass the driving test",
            groups = DriverChecks.class
    )
    public boolean hasDrivingLicense;
    @NotNull
    private String name;

    public Driver(String name) {
        this.name = name;
    }
}
